import request from '@/hooks/request'

const Api = {
  getNineOneAuthorize: '/platform/coupon/getNineOneAuthorizeUrl', // 91卡卷授权
  nineOnePageList: '/platform/coupon/nineOneUserPageList', // 91卡卷已授权用户列表
  nineOneDataPageList: '/platform/coupon/nineOneDataPageList', // 91卡卷卡种列表
  synchronizationCardRollNineOneData: '/platform/cardRoll/synchronizationCardRollNineOneData', // 同步91卡卷
  listCardRollNineOne: '/platform/coupon/nineOneUserList', // 查询已授权用户列表
  cardFishProductList: '/fish/product/couponFishProductList', // 91卡券关联商品列表
  cardRollRelevanceFishProduct: 'platform/coupon/couponRelevanceFishProduct', // 91卡券关联闲鱼商品
  cardRollCancelRelevanceFishProduct: '/platform/coupon/couponCancelRelevanceFishProduct', // 91卡券取消关联闲鱼商品
  getRelevanceFishProduct: '/fish/product/couponRelevanceFishProductList', // 91卡券关联闲鱼商品查询
  
  // 以下为星驰卡券相关接口
  xcDataPageList: '/platform/coupon/xcDataPageList', // 星驰卡卷列表
  xcUserDataInsert: '/platform/coupon/xcUserAdd', // 星驰卡卷用户新增
  xcUserDataPageList: '/platform/coupon/xcUserPageList', // 星驰卡卷用户列表
  xcUserRemarkDataEdit: '/platform/coupon/xcUserRemarkEdit', // 星驰卡卷 - 修改备注
  xcUserDataDelete: '/platform/coupon/xcUserDelete', // 星驰卡卷 - 删除
  xcUserDataEdit: '/platform/coupon/xcUserEdit', // 星驰卡卷 - 编辑
}

export const xcUserDataEdit = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.xcUserDataEdit,
    data: parameter,
  })
}

export const xcUserDataDelete = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('id', parameter.id)
  return request({
    method: 'post',
    url: Api.xcUserDataDelete,
    data: formData,
  })
}

export const xcUserRemarkDataEdit = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.xcUserRemarkDataEdit,
    data: parameter,
  })
}

export const xcUserDataPageList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.xcUserDataPageList,
    data: parameter,
  })
}

export const xcUserDataInsert = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.xcUserDataInsert,
    data: parameter,
  })
}

export const xcDataPageList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.xcDataPageList,
    data: parameter,
  })
}

export const getRelevanceFishProduct = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('couponId', parameter.couponId)
  formData.append('couponType', parameter.couponType)
  return request({
    method: 'post',
    url: Api.getRelevanceFishProduct,
    data: formData,
  })
}

export const cardRollCancelRelevanceFishProduct = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.cardRollCancelRelevanceFishProduct,
    data: parameter,
  })
}

export const cardRollRelevanceFishProduct = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.cardRollRelevanceFishProduct,
    data: parameter,
  })
}

export const cardFishProductList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.cardFishProductList,
    data: parameter,
  })
}

export const listCardRollNineOne = () => {
  return request({
    method: 'post',
    url: Api.listCardRollNineOne,
  })
}

export const synchronizationCardRollNineOneData = (parameter: Record<any, any>) => {
  const formData = new FormData()
  formData.append('userId', parameter.userId)
  return request({
    method: 'post',
    url: Api.synchronizationCardRollNineOneData,
    data: formData,
  })
}

export const nineOneDataPageList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.nineOneDataPageList,
    data: parameter,
  })
}

export const nineOnePageList = (parameter: Record<any, any>) => {
  return request({
    method: 'post',
    url: Api.nineOnePageList,
    data: parameter,
  })
}

export const getNineOneAuthorize = () => {
  return request({
    method: 'post',
    url: Api.getNineOneAuthorize,
  })
}
